package com.yupi.soulba.once;


import com.yupi.soulba.mapper.UserMapper;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;

import javax.annotation.Resource;

@Component
public class InsertUsers {
    
    @Resource
    private UserMapper userMapper;


    /**
     * 批量插入用户
     */
//    @Scheduled(initialDelay = 5000, fixedRate = Long.MAX_VALUE)
    public void doInsertUsers(){
        StopWatch stopWatch = new StopWatch();
        System.out.println("goodGuojiang");
        stopWatch.start();
        final int INSERT_NUM = 1000;
//        for (int i = 0; i < INSERT_NUM; i++) {
//            User user = new User();
//            user.setUsername("假果酱");
//            user.setUserAccount("fakeGuojiang");
//            user.setAvatarUrl("https://www.keaitupian.cn/cjpic/frombd/0/253/3498215567/1247959937.jpg");
//            user.setGender(0);
//            user.setUserPassword("b0dd3697a192885d7c055db46155b26a");
//            user.setPhone("111222333444");
//            user.setEmail("444333222111");
//            user.setTags("[]");
//            user.setUserStatus(0);
//            user.setUserRole(0);
//            user.setPlanetCode("11111111");
//            userMapper.insert(user);
//        }
        stopWatch.stop();
        System.out.println(stopWatch.getTotalTimeMillis());
    }
}
